import apiClient from './apiClient';
import { FileInfo } from '../../types';

export const fileService = {
  // 获取根目录信息
  getRootDirectory: async (): Promise<FileInfo> => {
    return await apiClient.get<any, FileInfo>('/file/root');
  },
  
  // 获取子目录内容
  getDirectoryChildren: async (path: string): Promise<FileInfo[]> => {
    return await apiClient.get<any, FileInfo[]>(`/file/children${encodeURIComponent(path)}`);
  },
  
  // 获取目录大小
  getDirectorySize: async (path: string): Promise<number> => {
    return await apiClient.get<any, number>(`/file/dir/size${encodeURIComponent(path)}`);
  },
};

export default fileService; 